package com.itheima.d4_TCP2;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.LinkedList;
import java.util.List;

public class Server {
    public static List<Socket> onLineSockets =new LinkedList<>();
    public static void main(String[] args)throws Exception {
        System.out.println("服务端启动成功");

        ServerSocket serverSocket =new ServerSocket(8889);



        while (true){
            Socket socket = serverSocket.accept();
            onLineSockets.add(socket);
            System.out.println("有人上线了"+socket.getRemoteSocketAddress());
            new ServerReaderThread(socket).start();
        }

    }
}
